package com.alks.function.mapper.biocontrol.deptwork;

import com.alks.entity.data.entity.PsScheduleHead;
import com.alks.function.data.dto.biocontrol.deptwork.ScheduleHeadDto;
import com.alks.function.data.request.biocontrol.deptwork.SchHeadMovRequest;
import com.alks.function.data.request.biocontrol.deptwork.ScheduleLotRequest;
import com.alks.function.data.vo.biocontrol.deptwork.ScheduleHeadExcelVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ms
 * @since 2024-01-04
 */
public interface BC_DW_PsScheduleHeadMapper extends BaseMapper<PsScheduleHead> {

    /*获取移序对应的最大序号*/
    BigDecimal indexMoveQuery(@Param("request") SchHeadMovRequest request, @Param("companyId") String companyId);

    /*更新序号*/
    void indexMove(@Param("headsEnd") ArrayList<PsScheduleHead> headsEnd);

    /*判断当日是否取过*/
    @Select("SELECT COUNT(*) FROM PS_SCHEDULE_HEAD WHERE SCHEDULE_NO = #{format}")
    Integer getCurrentList(String format);

    /*取进度表资料*/
    void insertIntoPcSch(@Param("format") String format);

    /*删除旧进度表*/
    void deleteIntoPcSch(@Param("format") String format, @Param("companyId") String companyId);

    /*序号上移下移*/
    void indexUpDown(@Param("request") SchHeadMovRequest request);

    /*进度查询*/
    List<ScheduleHeadDto> getScheduleQuery(@Param("request") ScheduleLotRequest request, @Param("companyId") String companyId);

    /*更新进度安排资料*/
    void scheduleHeadUp(@Param("lotNo") String lotNo, @Param("stdQty") String stdQty, @Param("companyId") String companyId);

    /*获取导表需要的数据*/
    List<ScheduleHeadExcelVo> scheduleHeadExpord(@Param("companyId") String companyId);
}
